home *** CD-ROM | disk | FTP | other *** search
/ PC Media 7 / PC MEDIA CD07.iso / share / prog / cm / cmqueue.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-06  |  1.2 KB  |  55 lines

  1. // CmQueue.cpp
  2. // -----------------------------------------------------------------
  3. // Compendium - C++ Container Class Library
  4. // Copyright (C) 1992-1994, Glenn M. Poorman, All rights reserved
  5. // -----------------------------------------------------------------
  6. // Queue implementation.
  7. // -----------------------------------------------------------------
  8.  
  9. #include <cm/include/cmqueue.h>
  10.  
  11.  
  12. // "CmQueue" is the default queue constructor.
  13. //
  14. CmQueue::CmQueue() : CmLinkedList()
  15. {}
  16.  
  17.  
  18. // "CmQueue" is the queue copy constructor.
  19. //
  20. CmQueue::CmQueue(const CmQueue& St) : CmLinkedList(St)
  21. {}
  22.  
  23.  
  24. // "=" assignment operator copies the specified queue into this queue.
  25. //
  26. CmQueue& CmQueue::operator=(const CmQueue& Qu)
  27. {
  28.   return (CmQueue&) CmLinkedList::operator=(Qu);
  29. }
  30.  
  31.  
  32. // "push" places the specified object into the end of the queue.
  33. //
  34. Bool CmQueue::push(CmObject* pObj)
  35. {
  36.   return append(pObj);
  37. }
  38.  
  39.  
  40. // "pop" pops the front object out of the queue and returns it.
  41. //
  42. CmObject* CmQueue::pop()
  43. {
  44.   return removeFirst();
  45. }
  46.  
  47.  
  48. // "peek" returns a pointer to the front object in the queue leaving the
  49. // object in place.
  50. // 
  51. CmObject* CmQueue::peek() const
  52. {
  53.   return first();
  54. }
  55.